<?php
$formid = $this->gpc["formid"];
$oid = $this->gpc["oid"];
$sql = "SELECT s.sms_note,s.sms_config,i.msg_templateid,i.openid,i.msg_roof,i.admin_phone,i.address FROM " . tablename("mii_ang_setting") . " s LEFT JOIN " . tablename("mii_ang_info") . " i ON s.uniacid= i.uniacid WHERE s.uniacid=:uniacid";
$config = pdo_fetch($sql, array(":uniacid" => $this->uniacid));
$admin_openid = $config["openid"];
$o = pdo_get("mii_ang_order", array("uniacid" => $this->uniacid, "oid" => $oid), array("details", "orderid"));
$de = @json_decode($o["details"], true);
$msg_roof = $config["msg_roof"];
$sendmsg = m("message");
$n1a1B = !($config["sms_note"] == "1");
if ($n1a1B) {
    $app_token = $this->App_getToken();
    $mp_token = $this->getToken();
    $senddata = array("keyword1" => array("value" => $de["uname"], "color" => "#173177"), "keyword2" => array("value" => $de["goodsname"], "color" => "#173177"), "keyword3" => array("value" => date("Y/m/d H:i", $de["starttime"]) . "-" . date("H:i", $de["endtime"]), "color" => "#173177"), "keyword4" => array("value" => $o["orderid"], "color" => "#173177"), "keyword5" => array("value" => $de["techname"], "color" => "#173177"), "keyword6" => array("value" => $config["address"], "color" => "#173177"), "keyword7" => array("value" => "您的预约订单号为 " . $o["orderid"] . " 请在 " . date("Y-m-d H:i", $de["starttime"]) . " 之前到达本店。", "color" => "#173177"));
    $resdata = $sendmsg->sendTplmessage($this->openid, $app_token, $config["msg_templateid"], $senddata, "mii_ang/pages/personal/index", $formid);
    $openid = @json_decode($admin_openid, true);
    $Oogt_ = !is_array($openid);
    if ($Oogt_) {
        return json_encode($msg);
    }
}
$msg = $sendmsg->sendSms($config, $o["details"]);
$sendmsg->sendmsg($config, $o["details"]);
$app_token = $this->App_getToken();
$mp_token = $this->getToken();
$senddata = array("keyword1" => array("value" => $de["uname"], "color" => "#173177"), "keyword2" => array("value" => $de["goodsname"], "color" => "#173177"), "keyword3" => array("value" => date("Y/m/d H:i", $de["starttime"]) . "-" . date("H:i", $de["endtime"]), "color" => "#173177"), "keyword4" => array("value" => $o["orderid"], "color" => "#173177"), "keyword5" => array("value" => $de["techname"], "color" => "#173177"), "keyword6" => array("value" => $config["address"], "color" => "#173177"), "keyword7" => array("value" => "您的预约订单号为 " . $o["orderid"] . " 请在 " . date("Y-m-d H:i", $de["starttime"]) . " 之前到达本店。", "color" => "#173177"));
$resdata = $sendmsg->sendTplmessage($this->openid, $app_token, $config["msg_templateid"], $senddata, "mii_ang/pages/personal/index", $formid);
$openid = @json_decode($admin_openid, true);
$Oogt_ = !is_array($openid);
if ($Oogt_) {
    return json_encode($msg);
}
foreach ($openid as $key => $v) {
    $sendmsg->admin_msg($v, $de, $msg_roof == "1" ? $mp_token : $app_token);
    //g9Ygc:
}
